<?php
	require_once 'config.php';
	$count = 8;
	$pagenum = ($_POST['pagenum']-1)*$count;
	$type = $_POST['type'];

	if ($type=='0') {
		$sql ="select * from picture where (is_open=1) order by updateTime desc limit $pagenum,$count";
	}else{
		$sql ="select * from picture where (is_open=1 and type=$type) order by updateTime desc limit $pagenum,$count";
	}
 	$res = $con->query($sql);
   	$data = array();
	while($row = mysqli_fetch_assoc($res)){
			$row['updateTime']= @date('Y-m-d',$row['updateTime']);
			 $data[] = $row;

	}
	echo json_encode(array_reverse($data));
?>